package com.bdmc.smokesensor.controller;

import java.util.Map;

import com.bdmc.smokesensor.Utils.Msg;
import com.bdmc.smokesensor.Utils.ResultUtil;
import com.bdmc.smokesensor.iservices.ISmk_HeartBeatService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/heart",method = RequestMethod.POST)
public class Smk_HeartBeatController extends BaseController{

    @Autowired
    private ISmk_HeartBeatService _heartSvs;

    @RequestMapping(value = "/list")
    public Msg list(@RequestBody Map<String, Object> reqMap) {
        int page = Integer.parseInt(reqMap.get("page").toString());
        int rows = Integer.parseInt(reqMap.get("rows").toString());
        String imei = reqMap.get("imei").toString();
        int dep_id = Integer.valueOf(request.getAttribute("dep_id").toString());
        Map<String, Object> result = _heartSvs.findByPageable(dep_id, imei,page,rows);
        return ResultUtil.success(result);
    }
}